﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace HarveyNash.RefactoringAndCodeSmell.CodeSmell.DuplicatedCode
{
    public static class Before
    {
        public static XmlElement CreateAddressElement(XmlDocument xmlDocument, Address address)
        {
            XmlElement element = xmlDocument.CreateElement("Address");

            XmlAttribute tempAttribute = null;
            tempAttribute = xmlDocument.CreateAttribute("Number");
            tempAttribute.Value = address.Number;
            element.SetAttributeNode(tempAttribute);

            tempAttribute = xmlDocument.CreateAttribute("Street");
            tempAttribute.Value = address.Street;
            element.SetAttributeNode(tempAttribute);

            tempAttribute = xmlDocument.CreateAttribute("City");
            tempAttribute.Value = address.City;
            element.SetAttributeNode(tempAttribute);

            tempAttribute = xmlDocument.CreateAttribute("Country");
            tempAttribute.Value = address.Country;
            element.SetAttributeNode(tempAttribute);

            return element;
        }
    }
}
